package com.atguigu.springcloud.controller;

import com.atgugui.springcloud.entities.CommonResult;
import com.atgugui.springcloud.entities.Payment;
import com.atguigu.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * @Author: lihan
 * @Date : 2021/12/8- 12
 * @DESCRIPTION: com.atguigu.springcloud.controller
 * @version: 1.0
 */
@RestController
@Slf4j
public class OrderFeignController {
@Autowired
    private PaymentFeignService paymentFeignService;

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){

        return  paymentFeignService.getPaymentById(id);
    }

    @GetMapping("/consumer/payment/create")
    public CommonResult<Payment> create(Payment payment){
        return paymentFeignService.create(payment);
    }

    @GetMapping("/consumer/payment/feign/timeout")
    public String paymentFeignTimeout(){

        return paymentFeignService.getFeignTimeOut();
    }
}
